<template>
    <div>
        <el-dialog
            :title="'修改站点'"
            append-to-body
            :visible="currentDialog"
            width="5`0%"
            @close="handleClose(0)"
        >
            <el-form label-position="left">
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="站点ID" prop="siteid">
                            <el-input v-model="form.siteid" disabled />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="基站名称" prop="sitename">
                            <el-input v-model="form.sitename" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="sim号码" prop="phone">
                            <el-input v-model="form.phone" placeholder="" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="ipv6" prop="ipv6">
                            <el-input v-model="form.ipv6" placeholder="" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="imeiid" prop="imeiid">
                            <el-input v-model="form.imeiid" placeholder="" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col style=" text-align: center; margin-top: 10px;">
                        <el-button @click="handleClose(0)">取 消</el-button>
                        <el-button type="primary" @click="handleSubmit">
                            确 定
                        </el-button>
                    </el-col>
                </el-row>
            </el-form>
        </el-dialog>
    </div>
</template>
<script>
export default {
    name: "SiteEdit",
    // eslint-disable-next-line vue/require-prop-types
    props: ["dialogswitch"],
    data() {
        return {
            form: {},
            siteid: "",
            sitename: "",
            sitephone: "",
            currentDialog: this.dialogswitch
        };
    },
    methods: {
        // 初始化数据 呈现弹窗的标题，联系人，传递属性值(cityvalue(区公司/市公司)，chargeman/thirdman，上云业务，传递属性标签(manage,local,extend)
        dataInitialization(row) {
            this.form = row;
        },
        handleSubmit() {
            this.$api
                .put(`/electricApi/datasite/${this.form.siteid}/`, this.form)
                .then(res => {
                    console.log(res);
                    this.$message({
                        message: "修改成功",
                        type: "success"
                    });
                    this.$emit("closeChange", true);
                });
        },
        handleClose(flag) {
            this.$emit("closeChange", flag);
        }
    }
};
</script>
<style>
.el-tag + .el-tag {
    margin-left: 10px;
    margin-bottom: 25px;
}
.text {
    font-size: 14px;
}
.item {
    margin-bottom: 12px;
}
</style>
